import {elements} from "./elements.js";
import {mainController} from "./mainController.js";
import {load} from "./resources.js";
import {keyFlagChangeTo0, keyFlagChangeTo1, mouseCreatEventHandler, mouseDeleteEventHandler} from "./events/handlers.js";


async function main() {
    elements.canvas.onclick = mouseCreatEventHandler;
    elements.canvas.ondblclick = mouseDeleteEventHandler;
    window.onkeydown = keyFlagChangeTo1;
    window.onkeyup = keyFlagChangeTo0;
    await load()

    mainController.init()
    mainController.run();
}

main().catch(e=>alert(`error occurred : ${e}`))